<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
function ajax() {
	var req = new XMLHttpRequest();
	req.onreadystatechange=function(){
		if(req.readyState==4) {
			alert(document.getElementById("msg").innerHTML);
			alert(req.responseText);
			document.getElementById("msg").innerHTML = req.responseText;
		}
	}
	req.open("GET", "test.txt", true);
	req.send();
}
</script>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<div id="msg"></div>
<button onclick="ajax();">AJAX</button>
</body>
</html>